package com.ybkj.daijia.server.service.impl;

import com.ybkj.daijia.server.mapper.OrderMapper;
import com.ybkj.daijia.server.mapper.OrderTempMapper;
import com.ybkj.daijia.server.model.OrderTemp;
import com.ybkj.daijia.server.service.OrderTempService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
public class DefaultOrderTempService implements OrderTempService {

    @Autowired
    private OrderTempMapper orderTempMapper;

    @Autowired
    private OrderMapper orderMapper;

    // 临时表查询一个订单信息
    @Override
    public OrderTemp findOne(Long id) {

        return orderTempMapper.selectByPrimaryKey(id);
    }

    // 临时表保存订单
    @Transactional(rollbackFor = Exception.class)
    public Long create(OrderTemp order) {

        return orderTempMapper.insertRecord(order);
    }

    @Transactional(rollbackFor = Exception.class)
    public void updateTreatment(Long id) {

        orderTempMapper.updateTreatment(id);

    }
}
		
